<template>
  <img alt="Vue logo" src="./assets/logo.png" />
  <HelloWorld msg="Welcome to Your Vue.js App" />
  <button @click="addnum">+100</button>
  <h2>{{ state.counter }}</h2>
  <ref />
  <div>
    <input type="text" name="" v-model="message" />
    <h2>{{ message }}</h2>
  </div>
  <watch />
  <computed />
  <refAtt />
  <group />
  <h title="我是传的render" />
  <direact />
  <plugins />
</template>

<script>
import plugins from "./views/plugins.vue";
import direact from "./views/directives.vue";
import h from "./components/h.vue";
import refAtt from "./components/refAttrabute.vue";
import computed from "./components/computed.vue";
import watch from "./components/Watch.vue";
import HelloWorld from "./components/HelloWorld.vue";
import ref from "./components/ref.vue";
import group from "./views/group.vue";
import { reactive } from "vue";
import userRef from "./hooks/userDebounceRef";
export default {
  name: "App",
  components: {
    HelloWorld,
    ref,
    watch,
    computed,
    refAtt,
    group,
    h,
    direact,
    plugins,
  },
  setup(props) {
    //使用reactive进行解析  使数据变成响应式
    const state = reactive({
      counter: 100,
    });
    let message = userRef("自己的ref方法去做对应数据劫持和更新视图");
    function addnum() {
      state.counter += 100;
    }
    return {
      state,
      addnum,
      message,
    };
  },
};
</script>

<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
</style>
